# This Python file uses the following encoding: utf-8
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

p = None

 
def DetectionPipelines():
    global p
    p = pipeline('ocr-detection', 'damo/cv_resnet18_ocr-detection-line-level_damo')


def runDetection():
    global p
    if p is not None:
        result = p('/home/mhc/Code/images/now.png',)
        result_str = str(result)  # 将字典转换为JSON字符串
        return result_str
    else:
        return 'debug'


def runDetectionArgs(imgPath):
    global p
    if p is not None:
        result = p(imgPath,)
        result_str = str(result)  # 将字典转换为JSON字符串
        return result_str
    else:
        return 'debug'


